%html
  %body
    %div
      .row
        .col-md-12.page-header-block
          .wrapper
            %span.green-font.big-title شـارك
            %span.gray-text فى نهضة البلاد وتابع نتائج البرزات القادمة
      .row
        .col-md-12.participate-flowchart-details.flowchart-item-details
          .wrapper
            - if Result.all.any? == false
              .row.final-results
                .col-md-4.depend
                  %span.final-results-title 
                  .decision-maker-info.col-md-8
                    %span.final-results-paragraph.bold-font لا يوجد نتائج 
                      

                .col-md-8.final
                  %span.final-results-title أخر النتائج
                  %span.final-results-sub-title
                    %span لا يوجد نتائج


                  %span.final-results-paragraph
                     
            - else
              .row.final-results
                .col-md-4.depend
                  %span.final-results-title واعتمد هذاالقرار من
                  .decision-maker-info.col-md-8
                    %span.final-results-paragraph.bold-font
                      = Result.last.decisionmakers[0].name
                      %br>/
                      = Result.last.decisionmakers[0].job  
 
                      
                  .final-results-img.col-md-4
                    = image_tag "atef-helmy.jpg"
                .col-md-8.final
                  %span.final-results-title أخر النتائج
                  %span.final-results-sub-title
                    %span :
                    بمناقشة 
                    = Result.last.initiatives[0].title
                    تم الاتفاق علي التالي


                  %span.final-results-paragraph
                    = Result.last.decision

      .row
        .col-md-12
          .wrapper 
            %span.col-md-6.margin-top
              %form{action: "/results/index"}
                %input.btn-default.search-btn{type: "submit", value: "ابحث"}
                %input.search-box.green-font{name: "searchResult", type: "text"}
                %span.main_title.active_title ابحث عن نتيجة
            
            .inner_menu.col-md-6
              .main_title.active_title نتائج المبادرات
            %br
            %br
            %br

            - @results.each do |result|
              - resultmaker = result.decisionmakers.where(result_id = result.id).all[0] 
              .row.cause-result-wrapper
                .col-md-6.cause-result-item
                  .row
                    .col-md-10
                      .timeline-item-supporter
                        .green-font.timeline-item-supporter-title.bold-font.result-font
                          معالي / #{resultmaker.name}
                        .green-font.timeline-item-supporter-sub-title.bold-font
                          = resultmaker.job
                        .light-text.timeline-item-supporter-sub-date
                          تاريخ 
                          = result.created_at.to_time.strftime('%A %e %B %Y')
                          = ((Time.now - result.updated_at) / 3600).round
                    .col-md-2
                      .timeline-item-supporter-img
                        = image_tag "ibrahim.jpg"
                  .timeline-item-details.gray-text
                    .green-font
                      تفاصيل القرار
                    %span.grey-font
                      #{link_to(result.decision[0, 10], {:controller => 'results' ,:action => "show", :id => result.id})}
                - initiative_data1 = result.initiatives.where(result_id = result.id).all
                .col-md-6.cause-result-item.border-right
                  - initiative_data1.each do |initiative_data|
                    .col-md-12.cause-result-item
                      .row
                        .col-md-8
                          .green-font.timeline-item-supporter-title.bold-font.result-font
                            #{link_to(initiative_data.title[0, 35], {:controller => 'initiatives' ,:action => "show", :id => initiative_data.id})}
                          .timeline-item-supporter-sub-title.gray-text.bold-font
                            مبادرة في 
                            %span.green-font.opacity-font
                              #{link_to(initiative_data.sector.name, {:controller => 'initiatives' ,:action => "list", :sector_name => initiative_data.sector.name})}
                            \- بإمارة
                            %span.green-font.opacity-font
                              #{link_to(initiative_data.region.name, {:controller => 'initiatives' ,:action => "list", :region_name => initiative_data.region.name})}
                          .timeline-item-details.gray-text
                            = initiative_data.description[0, 150]
                        .col-md-4
                          .cause-result-img
                            = image_tag initiative_data.image.url
                          .green-font.title-font 
                            = initiative_data.users.length
                          .light-green-font.cause-result-sub-title
                            شخص دعم المبادرة
          %form{action: "/results/create"}
            .col-md-9
            .btn.red-btn
              %input{type:"submit", value:"اصنع قرار"}



            .row
              .col-md-3
              .col-md-8.padding-bottom.float-left
                .digg_pagination
                  = will_paginate @results, inner_window: 1, :container => true, :next_label => ">", :previous_label => "<"
        




